<?php

namespace App\Http\Controllers;

use App\Article;
use App\Category;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class ListController extends Controller
{
    public function index(Request $request, $id)
    {
        $notice = Category::where('sort', '3')->first();
        $lists3 = Article::where('category_id', $notice->id)
            ->orderBy('updated_at', 'desc')
            ->take(10)->get();
        $category = Category::find($id);
        $lists = Article::where('category_id', '=', $id)
            ->paginate(10);
        return view('list', [
            'id' => $id,
            'lists' => $lists,
            'listTitle' => $category->name,
            'lists3' => $lists3
        ]);
    }
}